/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Francisco
 */
@Entity
@Table(name = "operar_consumo_consumible")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OperarConsumoConsumible.findAll", query = "SELECT o FROM OperarConsumoConsumible o"),
    @NamedQuery(name = "OperarConsumoConsumible.findByIdOperarConsumoConsumible", query = "SELECT o FROM OperarConsumoConsumible o WHERE o.idOperarConsumoConsumible = :idOperarConsumoConsumible"),
    @NamedQuery(name = "OperarConsumoConsumible.findByMonto", query = "SELECT o FROM OperarConsumoConsumible o WHERE o.monto = :monto")})
public class OperarConsumoConsumible implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_operar_consumo_consumible")
    private Integer idOperarConsumoConsumible;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "monto")
    private BigDecimal monto;
    @JoinColumn(name = "id_consumible", referencedColumnName = "id_consumible")
    @ManyToOne(optional = false)
    private Consumible idConsumible;
    @JoinColumn(name = "id_operar_consumo", referencedColumnName = "id_operar_consumo")
    @ManyToOne(optional = false)
    private OperarConsumo idOperarConsumo;

    public OperarConsumoConsumible() {
    }

    public OperarConsumoConsumible(Integer idOperarConsumoConsumible) {
        this.idOperarConsumoConsumible = idOperarConsumoConsumible;
    }

    public OperarConsumoConsumible(Integer idOperarConsumoConsumible, BigDecimal monto) {
        this.idOperarConsumoConsumible = idOperarConsumoConsumible;
        this.monto = monto;
    }

    public Integer getIdOperarConsumoConsumible() {
        return idOperarConsumoConsumible;
    }

    public void setIdOperarConsumoConsumible(Integer idOperarConsumoConsumible) {
        this.idOperarConsumoConsumible = idOperarConsumoConsumible;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public Consumible getIdConsumible() {
        return idConsumible;
    }

    public void setIdConsumible(Consumible idConsumible) {
        this.idConsumible = idConsumible;
    }

    public OperarConsumo getIdOperarConsumo() {
        return idOperarConsumo;
    }

    public void setIdOperarConsumo(OperarConsumo idOperarConsumo) {
        this.idOperarConsumo = idOperarConsumo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOperarConsumoConsumible != null ? idOperarConsumoConsumible.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OperarConsumoConsumible)) {
            return false;
        }
        OperarConsumoConsumible other = (OperarConsumoConsumible) object;
        if ((this.idOperarConsumoConsumible == null && other.idOperarConsumoConsumible != null) || (this.idOperarConsumoConsumible != null && !this.idOperarConsumoConsumible.equals(other.idOperarConsumoConsumible))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.OperarConsumoConsumible[ idOperarConsumoConsumible=" + idOperarConsumoConsumible + " ]";
    }
    
}
